package fr.charlesen.projets.utt.lo09.entites;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Charles EDOU NZE
 */
@Entity
@Table(name = "ETUDIANTS", catalog = "", schema = "CHARLES")
@NamedQueries({
    @NamedQuery(name = "Etudiants.findAll", query = "SELECT e FROM Etudiants e"),
    @NamedQuery(name = "Etudiants.findById", query = "SELECT e FROM Etudiants e WHERE e.id = :id"),
    @NamedQuery(name = "Etudiants.findByNom", query = "SELECT e FROM Etudiants e WHERE e.nom = :nom"),
    @NamedQuery(name = "Etudiants.findByPrenom", query = "SELECT e FROM Etudiants e WHERE e.prenom = :prenom"),
    @NamedQuery(name = "Etudiants.findByAutorisation", query = "SELECT e FROM Etudiants e WHERE e.autorisation = :autorisation")})
public class Etudiants implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "NOM", nullable = false, length = 45)
    private String nom;
    @Basic(optional = false)
    @Column(name = "PRENOM", nullable = false, length = 45)
    private String prenom;
    @Basic(optional = false)
    @Column(name = "AUTORISATION", nullable = false)
    private int autorisation;
    @JoinColumn(name = "ID_STAGE", referencedColumnName = "ID")
    @ManyToOne
    private Stages idStage;
    @JoinColumn(name = "ID_SUIVEUR", referencedColumnName = "ID")
    @OneToOne
    private Enseignantsuiveur idSuiveur;

    public Etudiants() {
    }

    public Etudiants(Integer id) {
        this.id = id;
    }

    public Etudiants(Integer id, String nom, String prenom, int autorisation) {
        this.id = id;
        this.nom = nom;
        this.prenom = prenom;
        this.autorisation = autorisation;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getPrenom() {
        return prenom;
    }

    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }

    public int getAutorisation() {
        return autorisation;
    }

    public void setAutorisation(int autorisation) {
        this.autorisation = autorisation;
    }

    public Stages getIdStage() {
        return idStage;
    }

    public void setIdStage(Stages idStage) {
        this.idStage = idStage;
    }

    public Enseignantsuiveur getIdSuiveur() {
        return idSuiveur;
    }

    public void setIdSuiveur(Enseignantsuiveur idSuiveur) {
        this.idSuiveur = idSuiveur;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Etudiants)) {
            return false;
        }
        Etudiants other = (Etudiants) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.charlesen.projets.utt.lo09.enites.Etudiants[id=" + id + "]";
    }
}
